package com.lnsf.converter;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.convert.converter.Converter;

import com.lnsf.entity.Department;
import com.lnsf.entity.Employee;
import com.lnsf.service.DeptService;

public class EmpToDeptConverter implements Converter<String, Department>{
	@Autowired
	private DeptService deptService;
	
	@Override
	public Department convert(String source) {
			
			Integer id =Integer.parseInt(source);
			System.out.println("部门编号："+id);
			
			Department department =	deptService.getDepartmentById(id);
			
		try {
			return department;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}
}
